package icu.javayanglei.bilibili.domain.vo;

import cn.hutool.core.util.PageUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 分页
 *
 * @author yang
 * @version 1.0.0
 * @date 2022-01-11 03:27
 */
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class PageVO {
    /**
     * 下标从1开始
     */
    public static Integer minPN = 1;
    /**
     * 总条数
     */
    private Integer count;
    /**
     * 每叶固定30条
     */
    private Integer ps = 30;
    /**
     * 有几个页
     */
    private Integer pn;

    public Integer calculationPn(){
        final int i = PageUtil.totalPage(this.count, this.ps);
        this.setPn(i);
        return i;
    }
}
